<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8" />
		<meta name="description" content="Admin Controler" />
		<meta name="author" content="Yuki" />		
		<link rel="stylesheet" href="/admin/themes/default/style.css" type="text/css" media="screen" />
		<script type="text/javascript" src="/component/js_lib/jquery-1.7.2.min.js"></script>
		<script src="/component/editors/tiny_mce/tiny_mce_popup.js" type="text/javascript"><!--mce:0--></script>

		<!-- Add jQuery library -->
		<title>图片上传-${DATA.blog.title}</title>
	</head>

<body>

<div id="nav">
		<div class="buttons">
				<a href="/admin/image/upload" class="button big">上传</a>
		</div>
</div>


<table summary="显示图片列表">
		<caption>图片列表</caption>
		<thead>
		<tr class="odd">
			<th scope="col" abbr="Photo ID">图片ID</th>
			<th scope="col" abbr="Photo cutImage">缩略图</th>	
			<th scope="col" abbr="Photo Action">操作</th>
		</tr>	
		</thead>
	%for photo in DATA.photoList:
		<tr class="${loop.cycle('even', 'odd')}">
			<td>${photo.photoID}</td>
			<td><a href="${photo.getURL('b')}" target="_blank"><img src="${photo.getURL()}"/></a></td>
			<td>
				<a  name="insert" href="${photo.getURL('b')}" onclick="InsertPhoto(this)">[插入]</a>
				<a name="delete" href="/admin/image/delete/${photo.photoID}">[删除]</a>		</td>
		</tr>
	%endfor
	</table>

<script type="text/javascript">

function InsertPhoto(value)
{
	var FileBrowserDialogue = {
	    insert : function (photoURL) {
	        var win = tinyMCEPopup.getWindowArg("window");
	        //就这句关键，IMG_URI应该由服务端生成
	        win.document.getElementById(tinyMCEPopup.getWindowArg("input")).value = photoURL;
	        tinyMCEPopup.close();
	    }
	};
	FileBrowserDialogue.insert(value);
}
</script>

</body>
</html>